package com.hh.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

import com.hh.jdbc.JDBCDemo;

public class CustomDAO {
	
	public boolean insert(String HYKH,String HYXM,String HYXB,String LXDH,String BLRQ,String BLRY,String SZMD){
		Connection con = null;
        PreparedStatement statement = null;
        try {
            Class.forName(JDBCDemo.cfn);
            con = DriverManager.getConnection(JDBCDemo.url,JDBCDemo.user,JDBCDemo.password);
            String sql = "insert into HY_HYDA (HYKH,HYXM,HYXB,LXDH,BLRQ,BLRY,SZMD,YXBZ) values(?,?,?,?,?,?,?,'正常')" ;
            statement = con.prepareStatement(sql);
            statement.setString(1, HYKH);
            statement.setString(2, HYXM);
            statement.setString(3, HYXB);
            statement.setString(4, LXDH);
            statement.setString(5, BLRQ);
            statement.setString(6, BLRY);
            statement.setString(7, SZMD);
            int i  = statement.executeUpdate();
            if(i>0){
            	return true;
            }
           
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }finally{
            try {
                if(statement != null) statement.close();
                if(con != null) con.close();
            } catch (Exception e2) {
                // TODO: handle exception
                e2.printStackTrace();
            }
        }
        return false;
	}
}
